// Copyright 2011 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


/*
 * @fileoverview Template for Status model.
 *
 * @author jasonstredwick@google.com (Jason Stredwick)
 */


{namespace bite.layer.soy.Status}


/**
 * Returns a link tag for the view.
 * @param baseUrl Base url for relative links.
 */
{template .getView}
<link rel="stylesheet" type="text/css"
      href="
        {if $baseUrl}
          {$baseUrl}
        {/if}
        styles/status.css">
{/template}


/**
 * Defines the model for the status console that allows users to check the
 * status of the various layers and reset them if necessary.
 */
{template .getModel}
<div id="layer-status-console" class="layer-console">
  <div class="layer-console-title">Layer Status</div>

  <div class="layer-console-body">
    <fieldset>
      <ol>
        <li>

          <table>
            <thead>
              <tr>
                <td></td>
                <td>On/Off</td>
                <td>On-demand</td>
                <td>Status</td>
                <td>Layer Url</td>
              </tr>
            </thead>
            <tbody id="layer-status-tbody">
            </tbody>
          </table>

        </li>
      </ol>
    </fieldset>
  </div>

  <div class="layer-console-footer">
    <button id="layer-status-reset-manager"
            type="button">Reset Manager</button>
    <button id="layer-status-restore" type="button">Restore Defaults</button>
    <button id="layer-status-close" class="layer-console-button-right"
            type="button">Close</button>
  </div>
</div>
{/template}


/**
 * @param baseUrl Base url for relative links.
 * @param id The layer name.
 */
{template .createRow}
  {if $id}
    <td>
      <button id="layer-status-reset-{$id|id}" type="button">Reset</button>
    </td>
    <td>
      <input id="layer-status-state-{$id|id}" type="checkbox">
    </td>
    <td>
      <input id="layer-status-ondemand-{$id|id}" type="checkbox">
    </td>
    <td>
      <img id="layer-status-image-{$id|id}" width="16" height="16"
           src="{nil}
             {if $baseUrl}
               {$baseUrl}
             {/if}
             imgs/layerstate-error-16.png">
    </td>
    <td>
      {$id}
    </td>
  {/if}
{/template}

